﻿using ITXHWEB.Models;
using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Web.Mvc;
using WPFExcelReport;
using WPFExcelReport.Helpers;
using ITXHWEB.Infrastructure;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace ITXHWEB.Controllers
{
    public partial class WBBSTController : ITXController
    {   
        /// <summary>
        /// 装载所有布卷
        /// </summary>
        /// <param name="returnUrl"></param>
        /// <returns></returns>
        [ChildActionOnly]
        public ActionResult STKVVPACK(string returnUrl)
        {
            ModelState.Clear();
            MABF.CWBB.SLO = "01";
            MABF.CWBB.SLB = "CW";
            MABF.CWBB.LO = "01";
            MABF.CWBB.LB = "CW";
            MABF.CWBB.LP = "01    ";
            MABF.CWBB.WHP = MABF.CWBB.LO + MABF.CWBB.LB + MABF.CWBB.LP;
            try
            {
                MABF.CWBB.WBBSTKNR = "";
            }
            catch (Exception ex)
            {
                
                Tracer.Error(ex.StackTrace, ex);
            }
            return PartialView(MABF.CWBB);
        }
        [HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public ActionResult STKVVPACK(WBBSTModel model, string returnUrl)
        {
            try
            {
                MABF.CWBB.WBBSTKNR = model.WBBSTKNR.PadRight(12); 
                PM["STKNR"] = model.WBBSTKNR.PadRight(12);
                PM["LIEFSCH"] = MABF.CVVT.LIEFSCH;
                MABF.CWBB.INFO = MABF.CWBB.WBBSTKNR + "-已经装箱:" + VHP.VWBB.CHKVVPACK(PM); 
            }
            catch (Exception ex)
            {
                //ModelState.AddModelError("",ex.Message);
                Tracer.Error(ex.StackTrace, ex);
            }
            return RedirectToAction(MAPP, MAPP);
        } 
      
    }
}
